package com.kejiguan.ui.dialog;

import android.content.Context;

import com.kejiguan.ui.R;

/**
 * Created by apple on 16/3/13.
 */
public class AddNeItemDialogUtil {

    private static AddNeItemDialogUtil instance;
    private AddNeItemDialog addDeviceDialog;

    public AddNeItemDialogUtil() {
    }

    public static AddNeItemDialogUtil getInstance() {
        if (instance == null) {
            synchronized (AddNeItemDialogUtil.class) {
                if (instance == null) {
                    instance = new AddNeItemDialogUtil();
                }
            }
        }
        return instance;
    }

    public void show(Context context, AddNeItemDialog.OnNewNeItemAddListener listener)
    {
        if (null == addDeviceDialog || !addDeviceDialog.isShowing())
        {
            addDeviceDialog = new AddNeItemDialog(context, R.style.dialog_tran);
        }
        addDeviceDialog.setOnNewNeItemAddListener(listener);
        addDeviceDialog.show();
    }

    public void dismiss() {
        if (null != addDeviceDialog && addDeviceDialog.isShowing()) {
            addDeviceDialog.dismiss();
        }

    }
}
